#ifndef _SOCKETNOTIFICATION_HPP_
#define _SOCKETNOTIFICATION_HPP_

#include "jhdefs.hpp"
#include "net/Socket.hpp"
#include "msg/notification.hpp"
using JHCPP::msg::CNotification;

NET_NAMESPACE_BEGIN

class CSocketReactor;
class CSocketNotification : public CNotification
{
public:
	explicit CSocketNotification(CSocketReactor* pReactor);
	virtual ~CSocketNotification();

	CSocketReactor& source() const;
	CSocket socket() const;

private:
	void setSocket(const CSocket& socket);

	CSocketReactor* m_pReactor;
	CSocket         m_socket;

	friend class CSocketNotifier;
};


class CReadableNotification : public CSocketNotification
{
public:
	CReadableNotification(CSocketReactor* pReactor);
	~CReadableNotification();
};


class CWritableNotification : public CSocketNotification
{
public:
	CWritableNotification(CSocketReactor* pReactor);
	~CWritableNotification();
};


class CErrorNotification : public CSocketNotification
{
public:
	CErrorNotification(CSocketReactor* pReactor);
	~CErrorNotification();
};


class CTimeoutNotification : public CSocketNotification
{
public:
	CTimeoutNotification(CSocketReactor* pReactor);
	~CTimeoutNotification();
};


class CIdleNotification : public CSocketNotification
{
public:
	CIdleNotification(CSocketReactor* pReactor);
	~CIdleNotification();
};


class CShutdownNotification : public CSocketNotification
{
public:
	CShutdownNotification(CSocketReactor* pReactor);
	~CShutdownNotification();
};

NET_NAMESPACE_END

#endif
